-
Notifications
You must be signed in to change notification settings - Fork 138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP_Add Django Debug Toolbar #2940
base: testing
Are you sure you want to change the base?
Conversation
Add django-debug-toolbar package to the optional `dev` dependency group Add `--dev` flag to build.sh to run `poetry install` with that flag Add DjDTB to settings.py Add DjDTB urls
src/rockstor/settings.py
Outdated
DEBUG_TOOLBAR_CONFIG = { | ||
# Update to the latest AJAX request | ||
# Without this, we can only catch the initial request | ||
# which is not helpful in most of our cases | ||
"UPDATE_ON_FETCH": True | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DEBUG_TOOLBAR_CONFIG = { | |
# Update to the latest AJAX request | |
# Without this, we can only catch the initial request | |
# which is not helpful in most of our cases | |
"UPDATE_ON_FETCH": True | |
} | |
DEBUG_TOOLBAR_CONFIG = { | |
# Update to the latest AJAX request | |
# Without this, we can only catch the initial request | |
# which is not helpful in most of our cases | |
"UPDATE_ON_FETCH": True | |
# If using htmx, to retain toolbar handle | |
# through page renders add this | |
"ROOT_TAG_EXTRA_ATTRS": "hx-preserve" | |
} |
If the project is contemplating to use htmx (#2735 and #2821) then this would also be required (among other things of course to enable htmx overall), according to:
https://django-debug-toolbar.readthedocs.io/en/stable/tips.html#working-with-htmx-and-turbo
Rely on the DJANGO_DEBUG env variable to set DEBUG boolean that will in turn decide the installation of the dev group dependencies (includes the Django debug toolbar) as the appearance of the toolbar in the UI. Leave commented (= unset) by default to keep the default build NOT in the dev mode.
@phillxnet , I have now tried a different approach to "trigger" the installation of the dev dependencies and the toolbar itself into Django. The idea was to try to "streamline/simplify" the process for the user/developer and cut down the number of steps. I'm anxious about affecting "normal" builds and installs, though, so I would appreciate your feedback; hopefully my commits here won't affect an RPM build, install, and update. TestingEnsure all traces from previous/current install are wiped
Now, we can build Given this would be the very first run of the script, we can't rely on
Open browser and visit Rockstor's IP: the toolbar shows up To test rebuild after some development edits:
Open browser and visit Rockstor's IP: the toolbar shows up To test a normal build still works without installing the Debug Toolbar
Open browser and visit Rockstor's IP: the toolbar DOES NOT show up |
Initial commit adding Django Debug Toolbar #2939
dev
dependency group--dev
flag to build.sh to runpoetry install
with that flagThis pull request is created with the only purpose to illustrate what would need to be implemented to use Django Debug Toolbar.
Ideally, all changes to
settings.py
andurls.py
would need to be scripted as well so that no manual configuration would be required.To run this branch, first checkout, then build from source with the new
--dev
flag. For instance, I run the following:Note that
DEBUG
must be True for the toolbar to show up.